﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;


namespace WindowsGame4
{
    public class Field
    {
        private int maxCol;
        private int maxRow;
        private int[,] grid;

        //constructor
        public Field(int maxCol, int maxRow)
        {
            this.maxCol = maxCol;
            this.maxRow = maxRow;
            grid = new int[maxCol, maxRow];
        }

        //getter setter
        public int GetMaxCol()
        {
            return maxCol; 
        }
        public int GetMaxRow()
        {
            return maxRow;
        }
        public int[,] GetGrid()
        {
            return grid;
        }

        public void printField()
        {
            for (int i = 0; i < maxCol; i++)
            {
                for (int j = 0; j < maxRow; j++)
                {
                    Console.Write(i+","+j+"     ");
                }
                Console.WriteLine();
            }
        }

        /*other
        public Boolean isPlaceable(Movable movObj, int X, int Y){
            int rearX, rearY;
            switch (movObj.GetDirection())
            {
                case 1: //up
                    {
                        rearX = X;
                        rearY = Y + (movObj.GetLength() - 1);
                        break;
                    }
                case 2: //right
                    {
                        rearX = X - (movObj.GetLength() - 1);
                        rearY = Y;
                        break;
                    }
                case 3: //down
                    {
                        rearX = X;
                        rearY = Y - (movObj.GetLength() - 1);
                        break;
                    }
                case 4: //left
                    {
                        rearX = X + (movObj.GetLength() - 1);
                        rearY = Y;
                        break;
                    }
                default: 
                    { 
                        rearX = X; 
                        rearY = Y; 
                        break; 
                    }
            }
            return ((rearX < maxCol)&&
                    (rearX >= 0)&&
                    (rearY < maxRow)&&
                    (rearY >= 0)&&
                    (X < maxCol) &&
                    (X >= 0) &&
                    (Y < maxRow) &&
                    (Y >= 0));
        }*/
    }
}
